package com.site.controller.site;

import com.site.service.BannerService;
import com.site.service.InfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by robin on 2016/12/19.
 * 关于我们 Controller
 */
@Controller
@RequestMapping("au")
public class AboutUsController {
    @Autowired
    private BannerService bannerService;
    @Autowired
    private InfoService   infoService;

    @RequestMapping("company")
    public String company(Model model){
        model.addAttribute("plate","au");
        model.addAttribute("banner",bannerService.selectByCate("aboutUs"));
        return "site/aboutUs/company";
    }

    @RequestMapping("team")
    public String team(Model model){
        model.addAttribute("plate","au");
        model.addAttribute("banner",bannerService.selectByCate("aboutUs"));
        return "site/aboutUs/team";
    }

    @RequestMapping("news")
    public String news(Model model){
        model.addAttribute("plate","au");
        model.addAttribute("banner",bannerService.selectByCate("aboutUs"));
        return "site/aboutUs/news";
    }

    @RequestMapping("newsList")
    public String newsList(Model model,int pageNum){
        model.addAttribute("news",infoService.selectByCate("aboutNews",pageNum,10));
        return "site/aboutUs/newsList";
    }

    @RequestMapping("newsInfo")
    public String newsInfo(Model model,String news){
        model.addAttribute("plate","au");
        model.addAttribute("banner", bannerService.selectByCate("aboutUs"));
        model.addAttribute("news",infoService.selectInfo(news));
        return "site/aboutUs/newsInfo";
    }

    @RequestMapping("culture")
    public String culture(Model model){
        model.addAttribute("plate","au");
        model.addAttribute("banner",bannerService.selectByCate("aboutUs"));
        model.addAttribute("culture",infoService.selectByCate("aboutCulture"));
        return "site/aboutUs/culture";
    }

    @RequestMapping("cultureInfo")
    public String cultureInfo(Model model,String culture){
        model.addAttribute("plate","au");
        model.addAttribute("banner",bannerService.selectByCate("aboutUs"));
        model.addAttribute("culture",infoService.selectInfo(culture));
        return "site/aboutUs/cultureInfo";
    }

    @RequestMapping("care")
    public String care(Model model){
        model.addAttribute("plate","au");
        model.addAttribute("banner",bannerService.selectByCate("aboutUs"));
        model.addAttribute("care",infoService.selectByCate("aboutCare"));
        return "site/aboutUs/care";
    }

    @RequestMapping("careInfo")
    public String careInfo(Model model,String care){
        model.addAttribute("plate","au");
        model.addAttribute("banner",bannerService.selectByCate("aboutUs"));
        model.addAttribute("care",infoService.selectInfo(care));
        return "site/aboutUs/careInfo";
    }

    @RequestMapping("welfare")
    public String welfare(Model model){
        model.addAttribute("plate","au");
        model.addAttribute("banner",bannerService.selectByCate("aboutUs"));
        model.addAttribute("welfare",infoService.selectByCate("aboutWelfare"));
        return "site/aboutUs/welfare";
    }

    @RequestMapping("welfareInfo")
    public String welfareInfo(Model model,String welfare){
        model.addAttribute("plate","au");
        model.addAttribute("banner",bannerService.selectByCate("aboutUs"));
        model.addAttribute("welfare",infoService.selectInfo(welfare));
        return "site/aboutUs/welfareInfo";
    }
}
